"""常数文件"""
province_code = "110000"


class Status(object):
    """
    0：表示 成功
    8：表示 正常情况 前端弹出相应提示
    9：表示 发生错误 前端弹出错误提示
    以上描述的状态码是不阻塞页面的
    标明“前端单独处理”的状态码是前端单个处理的状态码，会阻塞页面
    """

    OK = 0
    SERVER_ERROR = 9
    REQUEST_METHOD_NOT_ALLOW = 901
    EMPTY_DATA_ERROR = 0
    PARAM_ERROR = 903

    TOKEN_ERROR = 403


class StatusMsg(object):
    OK = "操作成功"
    SERVER_ERROR = "服务器错误"
    REQUEST_METHOD_NOT_ALLOW = "请求方式错误"

    EMPTY_DATA_ERROR = "所查数据为空"
    PARAM_ERROR = "参数错误"

    TOKEN_ERROR = "登陆验证失败"


class ReturnType:
    """业务逻辑函数返回值"""

    ERROR = -1
    EMPTY = 0
    OK = 1


class TimeType:
    """时间类型"""

    DAY = 0
    MONTH = 1
    YEAR = 2


ORG_MAP = {1: "on5", 2: "on7"}


START_TIME = "T00:00:00Z"
END_TIME = "T23:00:00Z"

CUR_LOW = "503"

DUST_LEVEL_CRITERIA = [0.95, 0.9, 0.85]

ROUND_TWO = 2
ROUND_FOUR = 4

# 最大es查询条数
SCROLL_SIZE = 1000000

# 保留小数位数
ROUND_NUM = 4

# 默认一页返回数量
PAGE_SIZE = 10
PAGE_NO = 1

# 登陆密钥
SECRET_KEY = "udYesw12!d"
# 加密解密初始向量
SECRET_IV = "\1\2\3\4\5\6\7\x08"
# 编解码格式
CODE_FORMAT = "utf-8"
# 上传图片文件格式
ALLOWED_PIC = ["png", "jpg", "JPG", "PNG", "bmp", "jpeg", "JPEG"]

low_type_map = {
    "城市台区": ["城市居民", "城市混合", "城市工商业"],
    "农村台区": ["农村居民", "农村混合", "农村灌溉"],
}

low_type_map_for_sql = {
    "城市台区": ['"城市居民"', '"城市混合"', '"城市工商业"'],
    "农村台区": ['"农村居民"', '"农村混合"', '"农村灌溉"'],
}

low_type_map_new = {1101: [101, 102, 103], 1104: [104, 105, 106]}

low_type_map_for_sql_new = {
    1101: ["101", "102", "103"],
    1104: ["104", "105", "106"],
}

predict_columns_chinese_dict = {
    "org_name": "单位名称",
    "type_name": "行业",
    "date": "日期",
    "type": "类型",
    "data_type": "数据类型",
}

predict_columns_chinese_dict_cons = {
    "cons_name": "用户名称",
    "date": "日期",
    "type": "类型",
    "data_type": "数据类型",
}

fk_predict_columns_chinese_dict = {
    "org_name": "单位名称",
    "date": "日期",
    "type": "类型",
    "data_type": "数据类型",
}
